package modelo;

import java.text.DecimalFormat;

public class Resultados {
	
	private double ns1;
	private double ns2;
	private double nq1;
	private double nq2;
	private double x1;
	private double x2;
	private double w1;
	private double w2;
	private int n;

	/**
	 * 
	 */
	public void addValues(double ns1, double ns2, double nq1, double nq2,
			double x1, double x2, double w1, double w2) {
		this.ns1 += ns1;
		this.ns2 += ns2;
		this.nq1 += nq1;
		this.nq2 += nq2;
		this.x1 += x1;
		this.x2 += x2;
		this.w1 += w1;
		this.w2 += w2;
		this.n++;
	}
	
	public void addValues(Estatistica estatistica) {
		this.addValues(estatistica.getN1(), estatistica.getN2(), 
				estatistica.getNq1(), estatistica.getNq2(), 
				estatistica.getT1(), estatistica.getT2(), 
				estatistica.getW1(), estatistica.getW2());
	}
	
	public String toString() {
		DecimalFormat formatador = new DecimalFormat("##.########");
		
		String values = formatador.format(this.ns1 / n) + "; " + formatador.format(this.ns2 / n) + "; " + 
		formatador.format(this.nq1 / n) + "; " + formatador.format(this.nq2 / n) + "; " + 
		formatador.format(this.x1 / n) + "; " + formatador.format(this.x2 / n) + "; " + formatador.format(this.w1 / n) + "; " + formatador.format(this.w2 / n);
		
		return values.replace('.', ',');
	}

}
